<template>
	<div>
	<ShopHead>
		<div slot="islink" class="my_back fl" @click="$router.go(-1)"></div>
		<p slot="car">购物车</p>
	</ShopHead>
	<ShopCar :goods_info="goods_info"></ShopCar>
	<!-- <Btm></Btm> -->
	<BtmNavv></BtmNavv>
	</div>
</template>

<script>
	import ShopHead from '../../components/shopHead.vue'
	import ShopCar from './components/shopcar.vue'
	import Btm from './components/Btm.vue'
	export default{
		components:{
			ShopHead,Btm,ShopCar
		},
		data(){
			return {
				goods_info:'',
				num:0
			}
		},
		mounted() {
			this.$http.get('/goodscar/carinfo',{
				u_id:this.$store.state.u_id
			}).then(res=>{
				console.log(res)
				this.goods_info = JSON.parse(res.data.data[0].goods_info)
				// 计算总价
				for(var i = 0 ; i<this.goods_info.length;i++){
					this.num+=this.goods_info[i].g_price*this.goods_info[i].g_count
				}
			})
		}
		}
</script>

<style>
</style>
